<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>首页</title>
    <jsp:include page="include/resource.jsp"/>
</head>
<body>
<jsp:include page="include/header.jsp"/>
<div class="container" style="padding-left: 150px;padding-right: 150px">

    <div class="text-center">
        <h1>${news.name}</h1>
        <span class="label label-primary">${news.userName}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <span class="label label-success"><fmt:formatDate value="${news.addtime}" pattern="yyyy-MM-dd HH:mm:ss"/> </span>
        <a onclick="history.go(-1)" class="pull-right btn btn-default">返回</a>
        <hr/>
    </div>
    <div style="margin-bottom: 20px">${news.content}</div>

    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">发表评论</h3>
        </div>
        <form action="/comment/send.do" method="post">
            <input type="hidden" name="newsid" value="${news.id}">
            <div class="panel-body">
                <div class="form-group">
                    <textarea required name="content" class="form-control"></textarea>
                </div>
                <button class="btn btn-primary" type="submit">提交</button>
            </div>
        </form>
    </div>

    <hr/>

    <c:forEach items="${commentList}" var="item">
        <div class="media">
            <div class="media-body">
                <h4 class="media-heading">${item.userName}</h4>
                <p>${item.content}</p>
            </div>
        </div>
    </c:forEach>

</div>
</body>
</html>
